package cn.lili.modules.grab.dingdong;

import cn.lili.common.utils.ResultUtil;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.grab.GrabAdjunctParam;
import cn.lili.modules.grab.dingdong.reps.adjunct.AreaRespose;
import cn.lili.modules.grab.dingdong.reps.adjunct.RegionAllRespose;
import cn.lili.modules.grab.dingdong.service.DingdongAdjunctService;
import cn.lili.modules.grab.enums.SourceEnums;
import cn.lili.modules.grab.enums.StatusEnums;
import cn.lili.modules.grab.factory.adjunct.GrabAdjunctService;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Component
@Slf4j
public class GrabDingdongAdjunctServiceImpl implements GrabAdjunctService {

    @Resource
    private DingdongAdjunctService dingdongAdjunctService;

    @Override
    public SourceEnums step() {
        return SourceEnums.DINGDONG_ADJUNCT;
    }

    /**
     * 地址查询
     *
     * @param grabParam 参数
     */
    @Override
    public ResultMessage<Object> area(GrabAdjunctParam grabParam) {
        log.info("企叮当--地址查询入参----{}", JSONObject.toJSONString(grabParam));
        List<AreaRespose> areaResposeList = dingdongAdjunctService.area(grabParam.getAreaRequest());
        //其它业务逻辑
        return ResultUtil.data(StatusEnums.STATUS_200.getDes());
    }

    /**
     * 商品分类
     *
     * @param grabParam 参数
     */
    @Override
    public ResultMessage<Object> regionAll(GrabAdjunctParam grabParam) {
        log.info("企叮当--商品分类入参----{}", JSONObject.toJSONString(grabParam));
        List<RegionAllRespose> regionAllResposeList = dingdongAdjunctService.regionAll(grabParam.getRegionAllRequest());

        //其它业务逻辑
        return ResultUtil.data(StatusEnums.STATUS_200.getDes());
    }
}
